﻿using System.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SpreadsheetGear;
using Sustainalytics.ClientDW.DataAccessLayer;
using Sustainalytics.ClientDW.Entities;
using Sustainalytics.Companies;
using Sustainalytics.Controversies.BusinessLogic;
using Sustainalytics.DataLayer;
using Sustainalytics.DataLayer.Shared;
using Sustainalytics.Entities;

namespace Sustainalytics.Portfolios.BL.Tests
{
    [TestClass]
    public class PortfolioSecurityManagementTests
    {
        private IRepositoryCollection<Portfolio> _portfolioRepo { get; set; }
        private IRepositoryCollection<PortfolioDetails> _portfolioDetailsRepo { get; set; }
        private IClientDwRepository _clientDWRepo { get; set; }
        private IAccountsRepository _accountsRepository { get; set; }
        private IPortfolioManager PortfolioManager { get; set; }

        private IPortfolioSecuritiesImportManagement PortfolioSecurityManager { get; set; }
        private IPlainBl<CompanySearch> CompanySearchManager { get; set; }
        private ICompanySearchLogic _companySearchLogic { get; set; }

        [TestInitialize]
        public void Initialize()
        {
            //Create repository
            _portfolioRepo = new RepositoryCollection<Portfolio>(ConfigurationManager.ConnectionStrings["ClientPlatform_Test"].ConnectionString);
            _portfolioDetailsRepo = new RepositoryCollection<PortfolioDetails>(ConfigurationManager.ConnectionStrings["ClientPlatform_Test"].ConnectionString);
            _clientDWRepo = ClientDwRepository.GetInstance(ConfigurationManager.ConnectionStrings["ClientDW_Test"].ConnectionString);
            //this._companySearchRepository = ClientDwRepository.GetInstance(ConfigurationManager.ConnectionStrings["ClientDW_Test"].ConnectionString);
            _accountsRepository = AccountsRepository.GetAccountsRepository(ConfigurationManager.ConnectionStrings["ClientPlatform_Test"].ConnectionString);
            CompanySearchManager = PlainBlFactory.GetInstance<CompanySearch>(ConfigurationManager.ConnectionStrings["ClientDW_Test"].ConnectionString);
            _companySearchLogic = new CompanySearchLogic(
                CompanySearchManager,
                PlainBlFactory.GetInstance<CorporateData>(
                    ConfigurationManager.ConnectionStrings["ClientDW_Test"].ConnectionString),
                PlainBlFactory.GetInstance<CorporateIdentifierType>(
                    ConfigurationManager.ConnectionStrings["ClientDW_Test"].ConnectionString)
                );

            //PortfolioTestingData.CleanupPortfolioRepo(_portfolioRepo);
            //PortfolioTestingData.CleanupPortfolioDetailsRepo(_portfolioDetailsRepo);
            //PortfolioTestingData.CleanupCorporateDataRepo(_clientDWRepo);
            //PortfolioTestingData.CleanupCompanySearchManager(CompanySearchManager);

            //PortfolioTestingData.InitializeRepo(_portfolioRepo);
            //PortfolioTestingData.InitializeRepo(_portfolioDetailsRepo);
            //PortfolioTestingData.InitializeRepo(_clientDWRepo);
            //PortfolioTestingData.InitializeManager(CompanySearchManager);



            //Create BL
            PortfolioManager = new PortfolioManager(_portfolioRepo, _portfolioDetailsRepo, new RepositoryCollection<PortfolioUserInput>(ConfigurationManager.ConnectionStrings["ClientPlatform_Test"].ConnectionString));
            PortfolioSecurityManager = new PortfolioSecuritiesImportManagement(
                new PortfolioManager(
                    _portfolioRepo, 
                    _portfolioDetailsRepo, 
                    new RepositoryCollection<PortfolioUserInput>( ConfigurationManager.ConnectionStrings["ClientPlatform_Test"].ConnectionString)), new PortfolioWorksheetValidator());
            //this.PortfolioCompanyManager = new PortfolioCompanyManagement(this._portfolioCompanyRepo);
           // this.PortfolioSecurityManager = new PortfolioSecuritiesImportManagement();
        }

        [TestMethod]
        public void GetPortfolioSecuritiesTemplate_IsCorrect()
        {
            // Create a new empty workbook set.
            IWorkbookSet workbookSet = SpreadsheetGear.Factory.GetWorkbookSet();
            // Create a new empty workbook in the workbook set.

            IWorkbook portfolioExportWorkBook = workbookSet.Workbooks.Open(ConfigurationManager.ConnectionStrings["portfolioTemplates"].ConnectionString + "\\Template\\Portfolio Securities Template.xlsx");
            byte[] buffer = portfolioExportWorkBook.SaveToMemory(FileFormat.OpenXMLWorkbook);
            
           // workbook = workbookSet.Workbooks.OpenFromMemory(buffer);
            var resultSheet = portfolioExportWorkBook.Worksheets["Portfolio"];

            IRange cells = resultSheet.Cells;

            Assert.IsTrue(cells[0, 0].Value.ToString() == "Security name ", "The first column should be Security name!");
            Assert.IsTrue(cells[0, 1].Value.ToString() == "Security ID (required)", "The first column should be Security ID (required)!");
        }

        //[TestMethod]
        //public void ValidateUploadFilePortfolioSecurities_FileNoErrors()
        //{
        //    LongRunningTaskManagerHostConfiguration taskManagerHostConfig = ConfigurationManager.GetSection("longRunningTaskManagerHost") as LongRunningTaskManagerHostConfiguration;
        //    string filePath = "E:\\Client Platform\\Main\\Client Platform\\Sustainalytics.DataLayer.Tests\\Utility\\UploadSecuritiesForPortfolio\\PortfolioSecuritiesTemplate.xlsx";

        //    PortfolioUpload portfolioUpload = new PortfolioUpload();
        //    portfolioUpload.PortfolioId = new Guid("00000000-0000-0000-0000-000000000001");
        //    portfolioUpload.PortfolioName = "Test 1";
        //    portfolioUpload.UserId = new Guid("4387c2a7-1eda-11e4-92ce-6c3be5be9f98");
        //    portfolioUpload.AccountId = new Guid("528ea769-2d17-e411-92ce-6c3be5be9f98");
        //    portfolioUpload.InsertDate = DateTime.UtcNow;
        //    List<int> accountUniverses = new List<int> { 1, 2, 3, 4, 5 };

        //    byte[] newFileContent = PortfolioSecurityManager.ValidateUploadFilePortfolioSecurities(filePath, portfolioUpload, accountUniverses);

        //    Assert.IsTrue(PortfolioSecurityManager.details == "All securities successfully matched", "The file has no errors!");
        //   // Assert.IsTrue(PortfolioSecurityManager.portfolioDetailsList.Count == 3, "The portfolioDetailsList should have 3 elements");
        //    //Assert.IsTrue(PortfolioSecurityManager.clientPortfolioList.Count == 6, "The clientPortfolioList should have 7 elements");

        //    // Create a new empty workbook set.
        //    IWorkbookSet workbookSet = Factory.GetWorkbookSet();
        //    // Create a new empty workbook in the workbook set.
        //    IWorkbook workbook = workbookSet.Workbooks.Add();
        //    workbook = workbookSet.Workbooks.OpenFromMemory(newFileContent);
        //    var resultSheet = workbook.Worksheets["Portfolio"];

        //    IRange cells = resultSheet.Cells;

        //    //Header
        //    Assert.IsTrue(cells[0, 0].Value.ToString() == "Security name ", "The column should be Security name!");
        //    Assert.IsTrue(cells[0, 1].Value.ToString() == "Security ID (required)", "The column should be Security ID (required)!");
        //    Assert.IsTrue(cells[0, 2].Value.ToString() == "Matched Company name", "The column should be Matched Company name!");
        //    Assert.IsTrue(cells[0, 3].Value.ToString() == "Matched Company ID", "The column should be Matched Company CIQID!");

        //    //security `
        //    Assert.IsTrue(cells[1, 0].Value.ToString() == "Security 1", "The column has incorect data!");
        //    Assert.IsTrue(cells[1, 1].Value.ToString() == "20704112", "The column has incorect data!");
        //    Assert.IsTrue(cells[1, 2].Value.ToString() == "GF Securities Company Limited", "The column has incorect data!");
        //    Assert.IsTrue(cells[1, 3].Value.ToString() == "20704112", "The column has incorect data!");

        //    //security 2
        //    Assert.IsTrue(cells[2, 0].Value.ToString() == "Security 2", "The column has incorect data!");
        //    Assert.IsTrue(cells[2, 1].Value.ToString() == "LEI61317722", "The column has incorect data!");
        //    Assert.IsTrue(cells[2, 2].Value.ToString() == "Acter Co., Ltd.", "The column has incorect data!");
        //    Assert.IsTrue(cells[2, 3].Value.ToString() == "61317722", "The column has incorect data!");

        //    //security 3
        //    Assert.IsTrue(cells[3, 0].Value.ToString() == "Security 3", "The column has incorect data!");
        //    Assert.IsTrue(cells[3, 1].Value.ToString() == "ISIN83975449", "The column has incorect data!");
        //    Assert.IsTrue(cells[3, 2].Value.ToString() == "Linea Group Holding S.r.l.", "The column has incorect data!");
        //    Assert.IsTrue(cells[3, 3].Value.ToString() == "83975449", "The column has incorect data!");

        //    //security 4
        //    Assert.IsTrue(cells[4, 0].Value.ToString() == "Security 4", "The column has incorect data!");
        //    Assert.IsTrue(cells[4, 1].Value.ToString() == "BUI20704112", "The column has incorect data!");
        //    Assert.IsTrue(cells[4, 2].Value.ToString() == "GF Securities Company Limited", "The column has incorect data!");
        //    Assert.IsTrue(cells[4, 3].Value.ToString() == "20704112", "The column has incorect data!");

        //    //security 5
        //    Assert.IsTrue(cells[5, 0].Value.ToString() == "Security 5", "The column has incorect data!");
        //    Assert.IsTrue(cells[5, 1].Value.ToString() == "BBGID61317722", "The column has incorect data!");
        //    Assert.IsTrue(cells[5, 2].Value.ToString() == "Acter Co., Ltd.", "The column has incorect data!");
        //    Assert.IsTrue(cells[5, 3].Value.ToString() == "61317722", "The column has incorect data!");

        //    //security 6
        //    Assert.IsTrue(cells[6, 0].Value.ToString() == "Security 6", "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 1].Value.ToString() == "VALOR20704112", "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 2].Value.ToString() == "GF Securities Company Limited", "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 3].Value.ToString() == "20704112", "The column has incorect data!");

        //    //security 7
        //    Assert.IsTrue(cells[7, 0].Value.ToString() == "Security 7", "The column has incorect data!");
        //    Assert.IsTrue(cells[7, 1].Value.ToString() == "WKN20704112", "The column has incorect data!");
        //    Assert.IsTrue(cells[7, 2].Value.ToString() == "GF Securities Company Limited", "The column has incorect data!");
        //    Assert.IsTrue(cells[7, 3].Value.ToString() == "20704112", "The column has incorect data!");

        //    //security 8
        //    Assert.IsTrue(cells[8, 0].Value.ToString() == "Security 8", "The column has incorect data!");
        //    Assert.IsTrue(cells[8, 1].Value.ToString() == "CUSIP61317722", "The column has incorect data!");
        //    Assert.IsTrue(cells[8, 2].Value.ToString() == "Acter Co., Ltd.", "The column has incorect data!");
        //    Assert.IsTrue(cells[8, 3].Value.ToString() == "61317722", "The column has incorect data!");

        //    //security 9
        //    Assert.IsTrue(cells[9, 0].Value.ToString() == "Security 9", "The column has incorect data!");
        //    Assert.IsTrue(cells[9, 1].Value.ToString() == "Sedol61317722", "The column has incorect data!");
        //    Assert.IsTrue(cells[9, 2].Value.ToString() == "Acter Co., Ltd.", "The column has incorect data!");
        //    Assert.IsTrue(cells[9, 3].Value.ToString() == "61317722", "The column has incorect data!");

        //    //security 10
        //    Assert.IsTrue(cells[10, 0].Value.ToString() == "Security 10", "The column has incorect data!");
        //    Assert.IsTrue(cells[10, 1].Value.ToString() == "EX61:317722", "The column has incorect data!");
        //    Assert.IsTrue(cells[10, 2].Value.ToString() == "Acter Co., Ltd.", "The column has incorect data!");
        //    Assert.IsTrue(cells[10, 3].Value.ToString() == "61317722", "The column has incorect data!");

        //    //security 11
        //    Assert.IsTrue(cells[11, 0].Value.ToString() == "Security 11", "The column has incorect data!");
        //    Assert.IsTrue(cells[11, 1].Value.ToString() == "EXBBGID:83975449", "The column has incorect data!");
        //    Assert.IsTrue(cells[11, 2].Value.ToString() == "Linea Group Holding S.r.l.", "The column has incorect data!");
        //    Assert.IsTrue(cells[11, 3].Value.ToString() == "83975449", "The column has incorect data!");

        //    //security 12
        //    Assert.IsTrue(cells[12, 0].Value.ToString() == "Security 12", "The column has incorect data!");
        //    Assert.IsTrue(cells[12, 1].Value.ToString() == "BGC20:704112", "The column has incorect data!");
        //    Assert.IsTrue(cells[12, 2].Value.ToString() == "GF Securities Company Limited", "The column has incorect data!");
        //    Assert.IsTrue(cells[12, 3].Value.ToString() == "20704112", "The column has incorect data!");

        //    //security 13
        //    Assert.IsTrue(cells[13, 0].Value.ToString() == "Security 13", "The column has incorect data!");
        //    Assert.IsTrue(cells[13, 1].Value.ToString() == "BTC83:975449", "The column has incorect data!");
        //    Assert.IsTrue(cells[13, 2].Value.ToString() == "Linea Group Holding S.r.l.", "The column has incorect data!");
        //    Assert.IsTrue(cells[13, 3].Value.ToString() == "83975449", "The column has incorect data!");

        //    //security 14
        //    Assert.IsTrue(cells[14, 0].Value.ToString() == "Security 14", "The column has incorect data!");
        //    Assert.IsTrue(cells[14, 1].Value.ToString() == "BSI20:704112", "The column has incorect data!");
        //    Assert.IsTrue(cells[14, 2].Value.ToString() == "GF Securities Company Limited", "The column has incorect data!");
        //    Assert.IsTrue(cells[14, 3].Value.ToString() == "20704112", "The column has incorect data!");
        //}

        //[TestMethod]
        //public void ValidateUploadFilePortfolioSecurities_FileWithErrors1()
        //{
        //    LongRunningTaskManagerHostConfiguration taskManagerHostConfig = ConfigurationManager.GetSection("longRunningTaskManagerHost") as LongRunningTaskManagerHostConfiguration;
        //    string filePath = "E:\\Client Platform\\Main\\Client Platform\\Sustainalytics.DataLayer.Tests\\Utility\\UploadSecuritiesForPortfolio\\PortfolioSecuritiesTemplateSecurityIdNull.xlsx";

        //    PortfolioUpload portfolioUpload = new PortfolioUpload();
        //    portfolioUpload.PortfolioId = new Guid("00000000-0000-0000-0000-000000000001");
        //    portfolioUpload.PortfolioName = "Test 1";
        //    portfolioUpload.UserId = new Guid("4387c2a7-1eda-11e4-92ce-6c3be5be9f98");
        //    portfolioUpload.AccountId = new Guid("528ea769-2d17-e411-92ce-6c3be5be9f98");
        //    portfolioUpload.InsertDate = DateTime.UtcNow;
        //    List<int> accountUniverses = new List<int> { 1, 2, 3, 4, 5 };

        //    byte[] newFileContent = PortfolioSecurityManager.ValidateUploadFilePortfolioSecurities(filePath, portfolioUpload, accountUniverses);

        //    Assert.IsTrue(PortfolioSecurityManager.details == "5 securities successfully matched <br /> 1 securities not matched", "The error '5 securities successfully matched \n 1 securities not matched' should appear!");

        //    // Create a new empty workbook set.
        //    IWorkbookSet workbookSet = Factory.GetWorkbookSet();
        //    // Create a new empty workbook in the workbook set.
        //    IWorkbook workbook = workbookSet.Workbooks.Add();
        //    workbook = workbookSet.Workbooks.OpenFromMemory(newFileContent);
        //    var resultSheet = workbook.Worksheets["Portfolio"];

        //    IRange cells = resultSheet.Cells;

        //    //Header
        //    Assert.IsTrue(cells[0, 0].Value.ToString() == "Security name ", "The column should be Security name!");
        //    Assert.IsTrue(cells[0, 1].Value.ToString() == "Security ID (required)", "The column should be Security ID (required)!");
        //    Assert.IsTrue(cells[0, 2].Value.ToString() == "Matched Company name", "The column should be Matched Company name!");
        //    Assert.IsTrue(cells[0, 3].Value.ToString() == "Matched Company ID", "The column should be Matched Company CIQID!");

        //    //security `
        //    Assert.IsTrue(cells[1, 0].Value.ToString() == "Security 1", "The column has incorect data!");
        //    Assert.IsTrue(cells[1, 1].Value.ToString() == "20704112", "The column has incorect data!");
        //    Assert.IsTrue(cells[1, 2].Value.ToString() == "GF Securities Company Limited", "The column has incorect data!");
        //    Assert.IsTrue(cells[1, 3].Value.ToString() == "20704112", "The column has incorect data!");

        //    //security 2
        //    Assert.IsTrue(cells[2, 0].Value.ToString() == "Security 2", "The column has incorect data!");
        //    Assert.IsTrue(cells[2, 1].Value.ToString() == "LEI61317722", "The column has incorect data!");
        //    Assert.IsTrue(cells[2, 2].Value.ToString() == "Acter Co., Ltd.", "The column has incorect data!");
        //    Assert.IsTrue(cells[2, 3].Value.ToString() == "61317722", "The column has incorect data!");

        //    //security 3
        //    Assert.IsTrue(cells[3, 0].Value.ToString() == "Security 3", "The column has incorect data!");
        //    Assert.IsTrue(cells[3, 1].Value.ToString() == "ISIN83975449", "The column has incorect data!");
        //    Assert.IsTrue(cells[3, 2].Value.ToString() == "Linea Group Holding S.r.l.", "The column has incorect data!");
        //    Assert.IsTrue(cells[3, 3].Value.ToString() == "83975449", "The column has incorect data!");

        //    //security 4
        //    Assert.IsTrue(cells[4, 0].Value.ToString() == "Security 4", "The column has incorect data!");
        //    Assert.IsTrue(cells[4, 1].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[4, 2].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[4, 3].Value == null, "The column has incorect data!");

        //    //security 5
        //    Assert.IsTrue(cells[5, 0].Value.ToString() == "Security 5", "The column has incorect data!");
        //    Assert.IsTrue(cells[5, 1].Value.ToString() == "VALOR20704112", "The column has incorect data!");
        //    Assert.IsTrue(cells[5, 2].Value.ToString() == "GF Securities Company Limited", "The column has incorect data!");
        //    Assert.IsTrue(cells[5, 3].Value.ToString() == "20704112", "The column has incorect data!");

        //    //security 6
        //    Assert.IsTrue(cells[6, 0].Value.ToString() == "Security 6", "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 1].Value.ToString() == "WKN20704112", "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 2].Value.ToString() == "GF Securities Company Limited", "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 3].Value.ToString() == "20704112", "The column has incorect data!");
        //}

        //[TestMethod]
        //public void ValidateUploadFilePortfolioSecurities_FileWithErrors2()
        //{
        //    LongRunningTaskManagerHostConfiguration taskManagerHostConfig = ConfigurationManager.GetSection("longRunningTaskManagerHost") as LongRunningTaskManagerHostConfiguration;
        //    string filePath = "E:\\Client Platform\\Main\\Client Platform\\Sustainalytics.DataLayer.Tests\\Utility\\UploadSecuritiesForPortfolio\\PortfolioSecuritiesTemplateSecurityIdNotFound.xlsx";

        //    PortfolioUpload portfolioUpload = new PortfolioUpload();
        //    portfolioUpload.PortfolioId = new Guid("00000000-0000-0000-0000-000000000001");
        //    portfolioUpload.PortfolioName = "Test 1";
        //    portfolioUpload.UserId = new Guid("4387c2a7-1eda-11e4-92ce-6c3be5be9f98");
        //    portfolioUpload.AccountId = new Guid("528ea769-2d17-e411-92ce-6c3be5be9f98");
        //    portfolioUpload.InsertDate = DateTime.UtcNow;
        //    List<int> accountUniverses = new List<int> { };

        //    byte[] newFileContent = PortfolioSecurityManager.ValidateUploadFilePortfolioSecurities(filePath, portfolioUpload, accountUniverses);

        //    Assert.IsTrue(PortfolioSecurityManager.details == "No matches found for the uploaded securities.",
        //        "The error 'No matches found for the uploaded securities.' should appear!");

        //    // Create a new empty workbook set.
        //    IWorkbookSet workbookSet = Factory.GetWorkbookSet();
        //    // Create a new empty workbook in the workbook set.
        //    IWorkbook workbook = workbookSet.Workbooks.Add();
        //    workbook = workbookSet.Workbooks.OpenFromMemory(newFileContent);
        //    var resultSheet = workbook.Worksheets["Portfolio"];

        //    IRange cells = resultSheet.Cells;

        //    //Header
        //    Assert.IsTrue(cells[0, 0].Value.ToString() == "Security name ", "The column should be Security name!");
        //    Assert.IsTrue(cells[0, 1].Value.ToString() == "Security ID (required)", "The column should be Security ID (required)!");
        //    Assert.IsTrue(cells[0, 2].Value.ToString() == "Matched Company name", "The column should be Matched Company name!");
        //    Assert.IsTrue(cells[0, 3].Value.ToString() == "Matched Company ID", "The column should be Matched Company CIQID!");

        //    //security
        //    Assert.IsTrue(cells[1, 0].Value.ToString() == "Security 1", "The column has incorect data!");
        //    Assert.IsTrue(cells[1, 1].Value.ToString() == "CNE0000008L2", "The column has incorect data!");
        //    Assert.IsTrue(cells[1, 2].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[1, 3].Value == null, "The column has incorect data!");
        //    //Assert.IsTrue(cells[1, 4].Value.ToString() == "No Access", "The column has incorect data!");

        //    //security
        //    Assert.IsTrue(cells[2, 0].Value.ToString() == "Security 2", "The column has incorect data!");
        //    Assert.IsTrue(cells[2, 1].Value.ToString() == "SZSE:000777", "The column has incorect data!");
        //    Assert.IsTrue(cells[2, 2].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[2, 3].Value == null, "The column has incorect data!");
        //    //Assert.IsTrue(cells[2, 4].Value.ToString() == "No Access", "The column has incorect data!");

        //    //security
        //    Assert.IsTrue(cells[3, 0].Value.ToString() == "Security 3", "The column has incorect data!");
        //    Assert.IsTrue(cells[3, 1].Value.ToString() == "B56VQB4", "The column has incorect data!");
        //    Assert.IsTrue(cells[3, 2].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[3, 3].Value == null, "The column has incorect data!");
        //    //Assert.IsTrue(cells[3, 4].Value.ToString() == "No Access", "The column has incorect data!");

        //    //security
        //    Assert.IsTrue(cells[4, 0].Value.ToString() == "Security 4", "The column has incorect data!");
        //    Assert.IsTrue(cells[4, 1].Value.ToString() == "IQ83975449", "The column has incorect data!");
        //    Assert.IsTrue(cells[4, 2].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[4, 3].Value == null, "The column has incorect data!");
        //    //Assert.IsTrue(cells[4, 4].Value.ToString() == "No Access", "The column has incorect data!");

        //    //security
        //    Assert.IsTrue(cells[5, 0].Value.ToString() == "Security 5", "The column has incorect data!");
        //    Assert.IsTrue(cells[5, 1].Value.ToString() == "IQ61317722", "The column has incorect data!");
        //    Assert.IsTrue(cells[5, 2].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[5, 3].Value == null, "The column has incorect data!");
        //    //Assert.IsTrue(cells[5, 4].Value.ToString() == "No Access", "The column has incorect data!");

        //    //security
        //    Assert.IsTrue(cells[6, 0].Value.ToString() == "Security 5", "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 1].Value.ToString() == "IQ61317722", "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 2].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 3].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[6, 4].Value.ToString() == "No Access", "The column has incorect data!");

        //    //security
        //    Assert.IsTrue(cells[7, 0].Value.ToString() == "Security 6", "The column has incorect data!");
        //    Assert.IsTrue(cells[7, 1].Value.ToString() == "IQ61317722", "The column has incorect data!");
        //    Assert.IsTrue(cells[7, 2].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[7, 3].Value == null, "The column has incorect data!");
        //    Assert.IsTrue(cells[7, 4].Value.ToString() == "No Access", "The column has incorect data!");
        //}

        //[TestMethod]
        //public void ValidateUploadFilePortfolioSecurities_PortfolioIdEmpty_FileNoErrors()
        //{
        //    LongRunningTaskManagerHostConfiguration taskManagerHostConfig = ConfigurationManager.GetSection("longRunningTaskManagerHost") as LongRunningTaskManagerHostConfiguration;
        //    string filePath = "E:\\Surse\\Client Platform\\Main\\Client Platform\\Sustainalytics.DataLayer.Tests\\Utility\\UploadSecuritiesForPortfolio\\PortfolioSecuritiesTemplate.xlsx";

        //    PortfolioUpload portfolioUpload = new PortfolioUpload();
        //    portfolioUpload.PortfolioId = Guid.Empty;
        //    portfolioUpload.PortfolioName = "Test 1 portfolio";
        //    portfolioUpload.UserId = new Guid("4387c2a7-1eda-11e4-92ce-6c3be5be9f98");
        //    portfolioUpload.AccountId = new Guid("528ea769-2d17-e411-92ce-6c3be5be9f98");
        //    portfolioUpload.InsertDate = DateTime.UtcNow;
        //    List<int> accountUniverses = new List<int> { 1, 2, 3, 4, 5 };

        //    byte[] newFileContent = PortfolioSecurityManager.ValidateUploadFilePortfolioSecurities(filePath, portfolioUpload, accountUniverses);

        //    Assert.IsTrue(PortfolioSecurityManager.details == "All securities successfully matched", "The file has no errors!");
        //   // Assert.IsTrue(PortfolioSecurityManager.portfolioDetailsList.Count == 3, "The portfolioDetailsList should have 3 elements");
        //    //Assert.IsTrue(PortfolioSecurityManager.clientPortfolioList.Count == 6, "The clientPortfolioList should have 6 elements");
        //}
    }
}
